@extends('backend::layout')
@section('title',trans($page_title))
@section('content')
    @if(isset($search_tpl))
        {{$search_tpl->render()}}
    @endif
    @component('backend::component.table.table-content')
        @slot('page_title') {{$page_title}} @endslot
        @slot('tools_btn')
            @component('backend::component.form.button')
                @slot('title') 添加会员 @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                @slot('color') danger @endslot
                @slot('icon') hcl-user-add @endslot
                @slot('href') {{route('b_User_createUser')}} @endslot
            @endcomponent
        @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <table class="table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>
                            @component('backend::component.checkbox')
                                @slot('name') ids-all @endslot
                            @endcomponent
                        </th>
                        <th>账号</th>
                        @foreach($currencies as $name=>$title)
                            <td>{{$title}}</td>
                        @endforeach
                        <th>推荐人</th><th>报单人</th><th>级别</th><th>注册时间</th><th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $value)
                        <tr>
                            <td>
                                @component('backend::component.checkbox')
                                    @slot('name') id[] @endslot
                                    @slot('class') id @endslot
                                    @slot('value') {{$value->member_id}} @endslot
                                @endcomponent
                            </td>
                            <td>{{$value->user_number}}<br/>[{{$value->real_name}}][{{$value->user_phone}}]</td>
                            @foreach($currencies as $name=>$title)
                                <td>{{$value->wallet->{$name} ?? 0}}</td>
                            @endforeach
                           <td>
                                @if($value->referrer)
                                    {{$value->referrer->user_number}}<br/>
                                    [{{$value->referrer->real_name}}]
                                    [{{$value->referrer->user_phone}}]
                                @else
                                    无推荐人
                                @endif
                            </td>
                            <td>
                                @if($value->bdr)
                                    {{$value->bdr->user_number}}<br/>
                                    [{{$value->bdr->real_name}}]
                                    [{{$value->bdr->user_phone}}]
                                @else
                                    无报单人
                                @endif
                            </td>
                            <td>{{get_user_level($value->level)}}</td>
                            <td>{{$value->created_at}}</td>
                            <td>
                                @component('backend::component.form.button')
                                    @slot('title') 删除 @endslot
                                    @slot('icon') hcl-delete @endslot
                                    @slot('color') danger @endslot
                                    @slot('params') {"url":"{{route('b_User_deleteUser',['user_id'=>$value->member_id])}}","confirm":"true","title":"只能删除免费会员,确认继续删除吗？"} @endslot
                                    @slot('class') btn-ajax @endslot
                                @endcomponent

                                    @component('backend::component.form.button')
                                        @slot('title') 实单激活 @endslot
                                        @slot('icon') hcl-auth @endslot
                                        @slot('color') success @endslot
                                        @slot('params') {"url":"{{route('b_User_activatedUser',['user_id'=>$value->member_id])}}","confirm":"true","title":"激活后会员将不能被删除且会执行奖金流程,确认继续激活吗？"} @endslot
                                        @slot('class') btn-ajax @endslot
                                    @endcomponent

                                    @component('backend::component.form.button')
                                        @slot('title') 空单激活 @endslot
                                        @slot('icon') hcl-auth @endslot
                                        @slot('color') warning  @endslot
                                        @slot('params') {"url":"{{route('b_User_empty_activatedUser',['user_id'=>$value->member_id])}}","confirm":"true","title":"激活后会员将不能被删除且会不会执行奖金流程,确认继续激活吗？"} @endslot
                                        @slot('class') btn-ajax @endslot
                                    @endcomponent

                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                @slot('list_page')
                    {{$list->appends($search_tpl->getSearchData())->links('backend::public.pagination')}}
                @endslot
            @else
                @component('backend::public.empty_page')
                    @slot('info') 暂时没有会员 @endslot
                @endcomponent
            @endif
        @endslot
    @endcomponent
@endsection